package com.ruoyi.project.tool.swagger.UserController;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysTypeComment;
import com.ruoyi.project.system.service.ISysTypeCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@Api(description = "服务评论")
@RequestMapping("/mobileUser/typeComment")
public class UserTypeCommentController extends BaseController {
    @Autowired
    private ISysTypeCommentService sysTypeCommentService;


    @ApiOperation("查询列表")
    @GetMapping("/list")
    public TableDataInfo list(SysTypeComment sysTypeComment) {
        startPage();
        List<SysTypeComment> list = sysTypeCommentService.selectSysTypeCommentList(sysTypeComment);
        return getDataTable(list);
    }


/*    @ApiOperation("获取详细信息")
    @GetMapping(value = "/{commentId}")
    public AjaxResult getInfo(@PathVariable("commentId") Long commentId) {
        return AjaxResult.success(sysTypeCommentService.selectSysTypeCommentById(commentId));
    }*/

    @ApiOperation("新增")
    @Log(title = "新增", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTypeComment sysTypeComment) {
        sysTypeComment.setMobileUserId(SecurityUtils.getLoginUser().getSysMobileUser().getMobileUserId());
        return toAjax(sysTypeCommentService.insertSysTypeComment(sysTypeComment));
    }

/*    @ApiOperation("修改")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTypeComment sysTypeComment) {
        sysTypeComment.setMobileUserId(SecurityUtils.getLoginUser().getSysMobileUser().getMobileUserId());
        return toAjax(sysTypeCommentService.updateSysTypeComment(sysTypeComment));
    }


    @ApiOperation("删除")
    @Log(title = "", businessType = BusinessType.DELETE)
    @DeleteMapping("/{commentIds}")
    public AjaxResult remove(@PathVariable Long[] commentIds) {
        return toAjax(sysTypeCommentService.deleteSysTypeCommentByIds(commentIds));
    }*/
}
